(function($){
"use strict";
$('body').waitForImages(function(){
$(window).trigger("rt_images_loaded");
});
})(jQuery);
(function($){
"use strict";
$(window).load(function(){
if($(window).width() > 1024){
var header_height="-100";
var navigation_bar=$(".nav_shadow.sticky");
var sticky_wrapper=$('
').height(navigation_bar.outerHeight());
if(navigation_bar.length > 0){
sticky_wrapper.insertBefore(navigation_bar);
navigation_bar.appendTo(sticky_wrapper);
sticky_wrapper.waypoint({
offset: header_height,
handler:function(direction){
if(direction==='down'){
$(this).find(".nav_shadow").addClass("stuck fadeInDown animated").removeClass("default_position");
}else{
$(this).find(".nav_shadow").removeClass("stuck fadeInDown animated").addClass("default_position");
}}
});
}}
});
})(jQuery);
(function($){
"use strict";
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
$("body").addClass("mobile_device");
}})(jQuery);
(function($){
"use strict";
if(! $.fn.rt_parallax_backgrounds){
$.fn.rt_parallax_backgrounds=function(options){
$(this).each(function(){
var row=$(this).parents("div:eq(0)"),
row_height=row.outerHeight(),
row_width=row.outerWidth(),
row_inheight=row.height(),
row_paddings=row_height - row_inheight,
holder_height=row_height*1.4,
holder_width=row_width*1.4,
effect=$(this).attr("data-rt-parallax-effect"),
direction=$(this).attr("data-rt-parallax-direction"),
speed=0.15;
if(Modernizr.backgroundsize&&!$("body").hasClass("mobile_device")){
if(effect=="horizontal"){
$(this).css({ "background-image":"url("+$(this).attr("data-rt-background-image")+")", "height":row_height+"px", "width":holder_width+"px" });
}else{
$(this).css({ "background-image":"url("+$(this).attr("data-rt-background-image")+")", "height":holder_height+"px" });
}
$(this).waypoint({
triggerOnce: true,
offset: function(){
return $(window).height() + row_paddings;
},
handler: function(){
var visible_position=$(window).scrollTop();
if(effect=="horizontal"){
$(this).rt_horizontal_parallax_effect({ row_width: row_width, holder_width: holder_width, visible_position: visible_position, speed: speed, direction: direction });
}else{
$(this).rt_vertical_parallax_effect({ row_height: row_height, holder_height: holder_height, visible_position: visible_position, speed: speed, direction: direction });
}}
});
}else{
if($("body").hasClass("mobile_device")){
row.css({
"background-image":"url("+$(this).attr("data-rt-background-image")+")",
"background-size":"cover",
"background-attachment":"scroll",
"background-repeat":"no-repeat",
"background-position":"center center"
});
$(this).remove();
}else{
$(this).css({ "height":row_height+"px"});
$(this).css({
"filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("data-rt-background-image")+"', sizingMethod='scale')",
"-ms-filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("data-rt-background-image")+"', sizingMethod='scale')"
});
}}
});
}
$.fn.rt_horizontal_parallax_effect=function(options){
var $this=$(this),
$window=$(window),
invisible_part=options["holder_width"] - options["row_width"],
start_position=options["direction"]==-1 ? -1 * invisible_part:0;
if(start_position!=0) $this.rt_parallax_apply_css(start_position, 0);
$(window).scroll(function(event){
var move_rate=(options["visible_position"] - $window.scrollTop()) * options["speed"],
xPos=options["direction"]==-1 ? start_position - move_rate:move_rate;
if(xPos < -1 * invisible_part) xPos=-1 * invisible_part;
if(xPos > 0) xPos=0;
$this.rt_parallax_apply_css(xPos, 0);
});
}
$.fn.rt_vertical_parallax_effect=function(options){
var $this=$(this),
$window=$(window),
invisible_part=options["holder_height"] - options["row_height"],
start_position=options["direction"]==-1 ? -1 * invisible_part:0 ;
if(start_position!=0) $this.rt_parallax_apply_css(0, start_position);
$(window).scroll(function(event){
var move_rate=(options["visible_position"] - $window.scrollTop()) * options["speed"],
yPos=options["direction"]==-1 ? start_position - move_rate:move_rate;
if(yPos < -1 * invisible_part) yPos=-1 * invisible_part;
if(yPos > 0) yPos=0;
$this.rt_parallax_apply_css(0, yPos);
});
}
$.fn.rt_parallax_apply_css=function(x, y){
var is_rtl=$("body").hasClass("rtl");
x=is_rtl ? -1 * x:x;
$(this).css({
"-webkit-transform": "translate("+x+"px, "+y+"px)",
"-moz-transform": "translate("+x+"px, "+y+"px)",
"-ms-transform": "translate("+x+"px, "+y+"px)",
"-o-transform": "translate("+x+"px, "+y+"px)",
"transform": "translate("+x+"px, "+y+"px)"
});
}}
$(window).one('load rt_images_loaded', function(){
if($.fn.rt_parallax_backgrounds){
$('.rt-parallax-background').rt_parallax_backgrounds();
}});
$(window).on('resize', function(){
if($.fn.rt_parallax_backgrounds){
$('.rt-parallax-background').rt_parallax_backgrounds();
}});
})(jQuery);
(function($){
"use strict";
$.fn.rt_waypoint=function(group){
var i=1, animate_item="";
if(group=="single"){
animate_item=$(this);
}else{
animate_item=$(this).find('[data-rt-animate="animate"]');
}
animate_item.each(function(i){
$(this).waypoint({
triggerOnce: true,
offset: function(){
return $(window).height()-50;
},
handler: function(){
$(this).rt_start_animation(i);
}});
});
}
$.fn.rt_start_animation=function(i){
var
delay=i*0.1,
item=$(this),
easing=item.attr("data-rt-animation-type"),
group=item.attr("data-rt-animation-group");
item.addClass(easing + " animated ").css({'-webkit-animation-delay': (delay)+"s",'-moz-animation-delay': (delay)+"s",'-ms-animation-delay': (delay)+"s",'-o-animation-delay': (delay)+"s",'animation-delay': (delay)+"s"});
}
if(rt_theme_params["content_animations"]&&! $("body").hasClass("mobile_device")){
$(window).load(function(){
if($.fn.waypoint){
$('[data-rt-animation-group="group"]').each(function(i){
$(this).rt_waypoint("group");
});
$('[data-rt-animation-group="single"]').each(function(i){
$(this).rt_waypoint("single");
});
}});
if($('.top_content .ls-wp-container').length > 0&&$(window).width() > 1280){
$(".top_content").css({"min-height":$('.top_content .ls-wp-container').css("height")});
}
$(window).on('resize', function(){
if($('.top_content .ls-wp-container').length > 0){
$(".top_content").css({"min-height":"auto"});
}});
$('[data-flexfirstslide="true"]').each(function(){
$(this).parents(".flex-container:eq(0)").css({"min-height":$(this).attr("data-sliderminheight")});
});
}})(jQuery);
if("undefined"!=typeof jQuery){(function(a){a.imgpreload=function(b,c){c=a.extend({},a.fn.imgpreload.defaults,c instanceof Function?{all:c}:c);if("string"==typeof b){b=new Array(b)}var d=new Array;a.each(b,function(e,f){var g=new Image;var h=f;var i=g;if("string"!=typeof f){h=a(f).attr("src")||a(f).css('background-image').replace(/^url\((?:"|')?(.*)(?:'|")?\)$/mg, "$1");i=f}a(g).bind("load error",function(e){d.push(i);a.data(i,"loaded","error"==e.type?false:true);if(c.each instanceof Function){c.each.call(i)}if(d.length>=b.length&&c.all instanceof Function){c.all.call(d)}a(this).unbind("load error")});g.src=h})};a.fn.imgpreload=function(b){a.imgpreload(this,b);return this};a.fn.imgpreload.defaults={each:null,all:null}})(jQuery)}
(function($){
"use strict";
if(! $.fn.rt_imgpreload){
$.fn.rt_imgpreload=function(options){
var holder=$(this);
var image=$(this).find("img");
$(holder).addClass("img_loading");
image.imgpreload
({
each: function(){
if($(this).data('loaded')){
holder.removeClass("img_loading").addClass("img_loaded");
}}
});
}
$(".imgeffect, .featured_image_holder, .product_boxes .featured_image").rt_imgpreload();
}})(jQuery);
(function($){
"use strict";
$.fn.rt_retina_logo=function(options){
if(window.devicePixelRatio > 1){
var normal_size_logo=$(this);
var retina_logo=$(this).attr("data-retina");
if(! $(this).attr("data-width")){
var orginal_w=normal_size_logo.width();
$(this).attr("data-width",orginal_w);
}else{
var orginal_w=$(this).attr("data-width");
}
$(this).css({"width":orginal_w});
if(retina_logo!=""){
$(normal_size_logo).imgpreload({
all: function(){
$(this).css({"width":orginal_w}).attr("src", retina_logo);
}});
}}
};
$(window).on('load resize', function(){
$('#logo img:first-child').rt_retina_logo();
});
})(jQuery);
(function($){
"use strict";
var top_level_items=$("#navigation > li.multicolumn");
var column_count=5;
top_level_items.each(function(){
column_count=$(this).attr("data-column-size");
var $sub_menu=$(this).find("ul:eq(0)");
$sub_menu.find("ul").removeClass("sub-menu");
if($sub_menu.length >0){
$("").appendTo($(this));
var $lists=$sub_menu, group;
while(( group=$lists.find('> li:lt('+column_count+')').remove()).length){
$('').append(group).appendTo($(this).find(".multicolumn-holder"));
}
$lists.remove();
}});
})(jQuery);
(function($){
"use strict";
$.fn.rt_greyscale=function(options){
if(! Modernizr.cssfilters){
$(this).each(function(){
$(this).removeClass("bw_filter").addClass("bw_filter_ie");
var img_url=$(this).find("img").attr("src");
var svg_image='';
$(svg_image).appendTo($(this));
});
}};
$(window).on('load', function(){
$('.bw_filter').rt_greyscale();
});
})(jQuery);
(function($){
"use strict";
$.fn.rt_fixed_rows=function(options){
$(this).find('> .box').removeAttr('style');
if($(window).width() < 768){
return false;
}
var settings=$.extend({}, $.fn.rt_fixed_rows.defaults, options);
var fixed_rows=$(this);
fixed_rows.each(function(){
if(Modernizr.csstransforms3d){
$(this).find('> .box').css({'min-height':$(this).height() });
}else{
$(this).find('> .box').attr('style', 'height: '+$(this).height()+'px');
}});
};
$(window).on('load resize', function(){
$('.extra_paddings > .row').rt_fixed_rows();
$('.row.with_borders').rt_fixed_rows();
});
})(jQuery);
(function($){
"use strict";
$.fn.rt_product_hover_effect=function(options){
var settings=$.extend({}, $.fn.rt_product_hover_effect.defaults, options);
$(this).on("mouseover mouseleave",function(event){
var item_width=$(this).width(),
item_height=$(this).height(),
product_info=$(this).find(".product_info"),
product_info_layer=$(this).find(".product_info > div"),
featured_image=$(this).find(".featured_image");
$(this).css({"overflow":"hidden"});
if($(window).width() > 550){
product_info.css({
"width":item_width+"px",
"height":item_height+"px",
"position":"absolute",
"top":"0",
"left":"0",
"overflow":"auto",
"display":"block",
"opacity":"0",
}).addClass("box_sizing animated");
featured_image.addClass("animated");
if(event.type=="mouseover"){
product_info.css({"opacity":"1"}).addClass("fadeIn");
if(product_info.length > 0){
featured_image.css({"opacity":"0.07"});
}else{
featured_image.css({"opacity":"0.5"});
}}
if(event.type=="mouseleave"){
product_info.css({"opacity":"0"}).removeClass("fadeIn");
featured_image.css({"opacity":"1"});
}}
});
};
$(window).on('load resize', function(){
$('.product-showcase .with_effect > .box').rt_product_hover_effect();
});
})(jQuery);
(function($){
"use strict";
$.fn.rt_wc_product_hover_effect=function(options){
var settings=$.extend({}, $.fn.rt_wc_product_hover_effect.defaults, options);
$(this).on("mouseover mouseleave",function(event){
var item_width=$(this).width(),
item_height=$(this).height(),
product_info=$(this).find(".product_info"),
product_info_layer=$(this).find(".product_info > div"),
onsale=$(this).find(".onsale"),
featured_image=$(this).find(".featured_image");
$(this).css({"overflow":"hidden"});
if($(window).width() > 550){
product_info.css({
"width":item_width+"px",
"height":item_height+"px",
"position":"absolute",
"top":"0",
"left":"0",
"overflow":"auto",
"display":"table",
"opacity":"0",
}).addClass("box_sizing").addClass("animated");
product_info_layer.css({
"display":"table-cell",
"vertical-align":"middle",
}).addClass("box_sizing").addClass("animated");
featured_image.addClass("animated");
if(event.type=="mouseover"){
product_info.css({"opacity":"1"}).addClass("fadeIn");
featured_image.css({"opacity":"0.03"});
onsale.css({"display":"none"});
}
if(event.type=="mouseleave"){
product_info.css({"opacity":"0"}).removeClass("fadeIn");
featured_image.css({"opacity":"1"});
onsale.css({"display":"block"});
}}
});
};
$(window).on('load resize', function(){
$('.woocommerce.product_boxes .with_effect > .box').rt_wc_product_hover_effect();
});
})(jQuery);
(function($){
"use strict";
$("#mobile_bar .mobile_menu_control").on("click",function(){
$("#header .sticky-wrapper, .nav_shadow").toggleClass("active");
if($("#header .sticky-wrapper").hasClass("active")||$(".nav_shadow").hasClass("active")){
$(this).removeClass("icon-menu").addClass("icon-menu-outline");
if($("#top_bar").hasClass("active")){
$("#mobile_bar .top_bar_control").trigger("click");
}}else{
$(this).removeClass("icon-menu-outlineu").addClass("icon-menu");
}});
})(jQuery);
(function($){
"use strict";
$("#mobile_bar .top_bar_control").on("click",function(){
$("#top_bar").toggleClass("active");
if($("#top_bar").hasClass("active")){
$(this).removeClass("icon-cog").addClass("icon-up-open");
if($("#header .sticky-wrapper").hasClass("active")||$(".nav_shadow").hasClass("active")){
$("#mobile_bar .mobile_menu_control").trigger("click");
}}else{
$(this).removeClass("icon-up-open").addClass("icon-cog");
}});
})(jQuery);
(function($){
"use strict";
$.fn.rt_start_carousels=function(items,style){
var change_width;
var new_width;
var autoHeight_;
var add;
var parent_holder;
var sidebar_element;
var carousel_holder=$(this);
if(style!="rounded_carousel"){
change_width=carousel_holder.width(carousel_holder.width() + 20);
new_width=carousel_holder.width();
if($("body").hasClass("rtl")){
carousel_holder.css({ "marginRight":"-10px" });
}else{
carousel_holder.css({ "marginLeft":"-10px" });
}}
if(items==1){
autoHeight_=true;
}else{
autoHeight_=false;
}
if(carousel_holder.parents(".sidebar.sticky").length > 0){
autoHeight_=false;
}
var carousel=carousel_holder.find(".owl-carousel");
carousel.owlCarousel({
autoHeight: autoHeight_,
items: items,
itemsDesktop: false,
itemsDesktopSmall:[768,items],
itemsTablet: [767,1],
itemsMobile: [479,1],
navigation:true,
pagination: false,
navigationText:["",""],
rewindNav:true,
lazyLoad:true,
scrollPerPage:false,
slideSpeed:400,
paginationSpeed:600,
responsive: true,
responsiveRefreshRate: 0,
responsiveBaseWidth:window,
autoPlay: 12000,
beforeUpdate:function(){
if(style!="rounded_carousel"){
change_width=0;
carousel_holder.removeAttr("style");
change_width=carousel_holder.width(carousel_holder.width() + 20);
new_width=carousel_holder.width();
if($("body").hasClass("rtl")){
carousel_holder.css({ "marginRight":"-10px" });
}else{
carousel_holder.css({ "marginLeft":"-10px" });
}}
},
afterInit:function(){
add=42;
parent_holder=carousel.parents(".carousel-holder:eq(0)");
if(parent_holder.hasClass("with_heading")){
if(parent_holder.hasClass("rounded_carousel_holder")){
add=add + 10;
}
carousel.find(".owl-controls").css({"top": -1 *(add +(( parent_holder.prev(".title_line").height() - 25) / 2)) +"px"});
}}
});
};})(jQuery);
(function($){
"use strict";
if($("#top_search_field").length > 0){
var value_length=$("#top_search_field").val().length;
var isiPad=navigator.userAgent.match(/iPad/i)!=null;
var add_value;
if(isiPad){
add_value=value_length;
}else{
add_value=value_length - 2;
}
if(value_length > 4){
$("#top_search_field").attr("size", add_value);
}}
})(jQuery);
(function($){
"use strict";
$(window).load(function(){
if($.isFunction($.fn.customSelect)){
$('.orderby, .variations select, .widget .menu.dropdown-menu').customSelect({ customClass: "wooselect" });
}});
})(jQuery);
(function($){
"use strict";
$('#MobileMainNavigation').change(function(){
window.location.href=$(this +'option:selected').val();
});
})(jQuery);
(function($){
"use strict";
$("#container").on("click",function(){
return true;
});
})(jQuery);
(function($){
"use strict";
$(".line span.top").click(function(){
$('html, body').animate({ scrollTop: 0 }, 'slow');
});
})(jQuery);
(function($){
"use strict";
if($.jackBox){
$(".lightbox_[data-group]").jackBox("init", { preloadGraphics: false, baseName: rt_theme_params["rttheme_template_dir"] +"/js/lightbox", className: ".lightbox_", deepLinking:false, socialMedia:false, showInfoByDefault: true});
}})(jQuery);
(function($){
"use strict";
if(typeof mejs!='undefined'){
$('.progression-single').css({width:"100%",height:"100%"});
$('.progression-single').mediaelementplayer({
startVolume: 0.5,
features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
});
}})(jQuery);
(function($){
"use strict";
var val;
var form_inputs=$(".showtextback");
form_inputs.each(function(){
$(this).focus(function(){
val=$(this).val();
if($(this).attr("alt")!="0"){
$(this).attr("alt",$(this).attr("value"));
$(this).attr("value","");
}});
$(this).blur(function(){
if($(this).attr("alt")!="0"){
val=$(this).val();
if(val==''||val==$(this).attr("alt")){
$(this).attr("value",$(this).attr("alt"));
}}
});
$(this).keypress(function(){
$(this).attr("alt","0");
});
});
})(jQuery);
(function($){
"use strict";
$("ul.tabs").tabs("> .panes > .pane", {effect: 'fade'});
$(".vertical_tabs").each(function(){
var tab_nav=$(this).find(".tabs"),
tab_nav_height=tab_nav.height(),
pane=$(this).find(".pane");
pane.each(function(){
$(this).css({"min-height":tab_nav_height-41+"px"});
});
});
})(jQuery);
/* *******************************************************************************
SEARCH FIELD ALIGNMENT
**********************************************************************************
(function($){
"use strict";
$(window).load(function(){
var new_search_location=($('#navigation_bar').width() - $('#navigation').width() - 118) / 2;
if(new_search_location<60) $("#navigation_bar .search-bar").css("right",""+new_search_location+"px");
});
})(jQuery);
*/
(function($){
"use strict";
$("#menu_search .icon-search-1, #top_search_form .icon-search").on("click",function(){
$(this).parents("form:eq(0)").submit();
});
})(jQuery);
(function($){
"use strict";
$(document.body).on("click",".info_box .icon-cancel",function(){
$(this).parent(".info_box").fadeOut();
});
})(jQuery);
(function($){
"use strict";
var features;
var table=$(".pricing_table.compare");
$(table).each(function(i){
var start_position_element=$(this).find(".start_position");
var features_list=$(this).find(".table_wrap.features ul");
var new_offset=start_position_element.offset().top - $(this).offset().top;
features_list.css("top",new_offset-1);
});
$(table).each(function(){
features=[];
$(this).find(".table_wrap.features li").each(function(){
features.push($(this).html());
});
});
$(table).find(".table_wrap").each(function(i){
if($(this).hasClass("features")==""){
var i=0;
$(this).find("li").each(function(){
if(typeof features[i]!="undefined"){
$(this).prepend(''+features[i]+'
');
}
i++;
});
}});
})(jQuery);
jQuery(function($){
"use strict";
var loader=$('').appendTo(".loading");
loader.hide();
$(".validate_form").each(function(){
var result=$(this).parents(".contact_form").find(".result");
if($.isFunction($.fn.validate)){
$.validator.messages.required="";
var v=$(this).validate({
submitHandler: function(form){
$(form).ajaxSubmit({
target: result,
beforeSubmit: function(){loader.show()},
url: rt_theme_params["ajax_url"],
data: { action: 'rt_ajax_contact_form' },
success: function(){loader.hide()}});
}});
}});
});
(function($){
"use strict";
$(".rt-toggle .toggle-content").hide();
$(".rt-toggle .open .toggle-content").show();
$(".rt-toggle ol li .toggle-head").click(function(){
if($(this).parent("li").hasClass("open")){
$(this).parent("li").removeClass("open").find(".toggle-content").stop().slideUp(300);
}else{
$(this).parents("ol").find("li.open").removeClass("open").find(".toggle-content").stop().slideUp(300);
$(this).parent("li").addClass("open").find(".toggle-content").stop().slideDown(300, "easeInQuad");
}});
})(jQuery);
(function($){
"use strict";
if($.isFunction($.fn.colorTip)){
$('.j_ttip').colorTip({color:''});
}})(jQuery);
(function($){
"use strict";
var $sidebar=jQuery(".sidebar");
$sidebar.each(function(){
var sidebarH=$(this).height();
var parentContent=$(this).prev(".content");
var parentContentHeight=parentContent.height();
var the_heigtest_part=Math.max(0,parentContentHeight,sidebarH);
parentContent.css("min-height",the_heigtest_part);
});
})(jQuery);
(function($){
"use strict";
$.fn.getStyleObject=function(){
var dom=this.get(0);
var style;
var returns={};
if(window.getComputedStyle){
var camelize=function(a,b){
return b.toUpperCase();
};
style=window.getComputedStyle(dom, null);
for(var i=0, l=style.length; i < l; i++){
var prop=style[i];
var camel=prop.replace(/\-([a-z])/g, camelize);
var val=style.getPropertyValue(prop);
returns[camel]=val;
};
return returns;
};
if(style=dom.currentStyle){
for(var prop in style){
returns[prop]=style[prop];
};
return returns;
};
return this.css();
}})(jQuery);
(function($){
"use strict";
if(/chrome/.test(navigator.userAgent.toLowerCase())){
$(".content_block_background").each(function(){
$(this).css("background-attachment", "scroll");
});
}})(jQuery);
(function($){
"use strict";
$.rt_maps=function(el, locations, zoom){
var base=this;
base.init=function(){
if(locations.length>0) google.maps.event.addDomListener(window, 'load', $.fn.rt_maps());
};
if(locations.length>0) base.init();
};
$.fn.rt_maps=function(locations, zoom){
var map_id=$(this).attr("id");
var height=$('[data-scope="#'+map_id+'"]').attr("data-height");
if(height > 0){
$(this).css({'height':height+"px"});
}
var myOptions={
zoom: zoom,
panControl: true,
zoomControl: true,
scaleControl: true,
streetViewControl: false,
overviewMapControl: false,
scrollwheel:false,
navigationControl: true,
center: new google.maps.LatLng(0, 0),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map=new google.maps.Map(document.getElementById(map_id), myOptions);
var bwmap=$('[data-scope="#'+map_id+'"]').attr("data-bw");
if(typeof bwmap!=="undefined"&&bwmap!=""){
var styles=[
{
stylers: [
{ hue: "#fff" },
{ saturation: -100 },
{ lightness: 0 },
{ gamma: 1 }
]
}
];
var styledMap=new google.maps.StyledMapType(styles, {name: "Styled Map"});
map.mapTypes.set('map_style', styledMap);
map.setMapTypeId('map_style');
}
$.fn.setMarkers(map, locations);
$.fn.fixTabs(map,map_id,zoom);
};
$.fn.setMarkers=function (map, locations){
if(locations.length>1){
var bounds=new google.maps.LatLngBounds();
}else{
var center=new google.maps.LatLng(locations[0][1], locations[0][2]);
map.panTo(center);
}
for (var i=0; i < locations.length; i++){
if(locations[i] instanceof Array){
var location=locations[i];
var myLatLng=new google.maps.LatLng(location[1], location[2]);
var marker=new google.maps.Marker({
position: myLatLng,
map: map,
animation: google.maps.Animation.DROP,
draggable: false,
title: location[0]
});
$.fn.add_new_event(map,marker,location[4]);
if(locations.length>1) bounds.extend(myLatLng);
}}
if(locations.length>1) map.fitBounds(bounds);
};
$.fn.add_new_event=function (map,marker,content){
if(content){
var infowindow=new google.maps.InfoWindow({
content: content,
maxWidth: 300
});
google.maps.event.addListener(marker, 'click', function(){;
infowindow.open(map,marker);
});
}};
$.fn.fixTabs=function (map,map_id,zoom){
var tabs_wrap=$("#"+map_id).parents(".tabs_wrap:eq(0)");
$(".tabs_wrap > ul > li").on("click", { map: map } , function(){
var c=map.getCenter();
google.maps.event.trigger(map, 'resize');
map.setZoom(zoom);
map.setCenter(c);
});
};})(jQuery);
(function($){
"use strict";
if(rt_theme_params["page_loading"]){
$(window).load(function(){
$(".rt_loading").css({"display":"none"});
});
}})(jQuery);
(function($, window, document, undefined){
"use strict";
$.fn.doubleTapToGo=function(params){
if(! Modernizr.touch){
return false;
}
this.each(function(){
var curItem=false;
$(this).on('click', function(e){
var item=$(this);
if(item[ 0 ]!=curItem[ 0 ]){
e.preventDefault();
curItem=item;
}});
$(document).on('click touchstart MSPointerDown', function(e){
var resetItem=true,
parents=$(e.target).parents();
for(var i=0; i < parents.length; i++)
if(parents[ i ]==curItem[ 0 ])
resetItem=false;
if(resetItem)
curItem=false;
});
});
return this;
};
if($(window).width() > 960){
if($('.rev_slider_wrapper').length > 0){
$('#navigation li:has(ul)').doubleTapToGo();
}}
})(jQuery, window, document);
(function($, window, document, undefined){
"use strict";
$.fn.singleTapFix=function(params){
if(! Modernizr.touch){
return false;
}
this.each(function(){
var curItem=false;
$(this).on('touchstart', function(e){
return this;
});
});
return this;
};
if($(window).width() < 960){
$('#navigation a').singleTapFix();
}})(jQuery, window, document);
(function($){
"use strict";
if(! $.fn.rt_add_to_cart){
$.fn.rt_add_to_cart=function(){
if(typeof wc_cart_fragments_params=='undefined'){
return ;
}
$('body').on('added_to_cart', function(){
$(window).scrollTop(0);
setTimeout(function(){
$(window).trigger("rt_fix_sticky_sidebar");
},50);
});
}}
$.fn.rt_add_to_cart();
if(! $.fn.rt_sticky_sidebar){
$.fn.rt_sticky_sidebar=function(){
if($(this).length==0){
return;
}
if($(window).width() < 1025){
$(this).each(function(){
$(this).removeAttr("style");
});
return;
}
var $window=$(window);
var $stickyHeaderFields="#wpadminbar, .nav_shadow.stuck";
$(this).each(function(){
$(this).removeAttr("style");
var $content_block=$(this).parents(".content_block:eq(0)"),
$content=$content_block.find(".content"),
$sidebar=$(this),
padding=20,
sidebar_left_position=$sidebar.hasClass("left") ? $sidebar.offset().left - 10:$sidebar.offset().left,
sidebar_first_left_position=$sidebar.position().left,
sidebarHeight=$sidebar.outerHeight(),
sidebarWidth=$sidebar.outerWidth(),
contentHeight=$content.outerHeight(),
sidebar_position=$sidebar.position().top,
content_block_top=$content_block.offset().top - 20,
window_height=$(window).height(),
sidebar_bottom=(sidebar_position + sidebarHeight + content_block_top) - window_height;
if(contentHeight > sidebarHeight){
$window.scroll(function(event){
var scrollTop=$window.scrollTop();
sidebarHeight=$sidebar.outerHeight();
var $addHeigth=0;
$($stickyHeaderFields).each(function(){
$addHeigth=$addHeigth + $(this).height();
});
var top_position=scrollTop + $addHeigth + padding,
maxposition=contentHeight -(sidebar_position + sidebarHeight) + padding,
topPosition=-1 * Math.min(0 , content_block_top - top_position);
topPosition=Math.min(maxposition, topPosition);
if(content_block_top - top_position > 0){
$sidebar.removeAttr("style");
return;
}
if(maxposition==topPosition){
$sidebar.css({
"position": "absolute",
'top':(contentHeight - sidebarHeight) + "px",
'left': sidebar_first_left_position + "px",
'width': sidebarWidth +"px",
});
return;
}
if(content_block_top - top_position < 0){
$sidebar.css({
"position": "fixed",
'top': $addHeigth + padding + "px",
'left': sidebar_left_position + "px",
'width': sidebarWidth +"px"
});
return;
}});
}});
};}
$(window).one("rt_images_loaded",function(e){
$(".sidebar.sticky").rt_sticky_sidebar();
$(window).trigger("scroll");
});
$(window).on("resize rt_fix_sticky_sidebar",function(e){
$(".sidebar.sticky").rt_sticky_sidebar();
$(window).trigger("scroll");
});
})(jQuery);
var addComment={moveForm:function(a,b,c,d){var e,f,g,h,i=this,j=i.I(a),k=i.I(c),l=i.I("cancel-comment-reply-link"),m=i.I("comment_parent"),n=i.I("comment_post_ID"),o=k.getElementsByTagName("form")[0];if(j&&k&&l&&m&&o){i.respondId=c,d=d||!1,i.I("wp-temp-form-div")||(e=document.createElement("div"),e.id="wp-temp-form-div",e.style.display="none",k.parentNode.insertBefore(e,k)),j.parentNode.insertBefore(k,j.nextSibling),n&&d&&(n.value=d),m.value=b,l.style.display="",l.onclick=function(){var a=addComment,b=a.I("wp-temp-form-div"),c=a.I(a.respondId);if(b&&c)return a.I("comment_parent").value="0",b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b),this.style.display="none",this.onclick=null,!1};try{for(var p=0;p1e3)g=1e3;else if(~~g<200)g=200;f.height=g}if("link"===d.message)if(h=b.createElement("a"),i=b.createElement("a"),h.href=f.getAttribute("src"),i.href=d.value,i.host===h.host)if(b.activeElement===f)a.top.location.href=d.value}else;}},d)a.addEventListener("message",a.wp.receiveEmbedMessage,!1),b.addEventListener("DOMContentLoaded",c,!1),a.addEventListener("load",c,!1)}(window,document);
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("").attr("name",
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/,
"");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=
this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",
a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=
a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?
this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+
a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+a.name+"")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=
d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);
if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=
this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,
e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};
var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?
e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;
return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,
b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,
mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,
b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);
;(function($){
"use strict";
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are mutually exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function(){
$('#myForm').on('submit', function(e){
e.preventDefault();
$(this).ajaxSubmit({
target: '#output'
});
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function(){
$('#myForm').ajaxForm({
target: '#output'
});
});
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
form does not have to exist when you invoke ajaxForm:
$('#myForm').ajaxForm({
delegation: true,
target: '#output'
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
var feature={};
feature.fileapi=$("").get(0).files!==undefined;
feature.formdata=window.FormData!==undefined;
$.fn.ajaxSubmit=function(options){
if(!this.length){
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
var method, action, url, $form=this;
if(typeof options=='function'){
options={ success: options };}
method=this.attr('method');
action=this.attr('action');
url=(typeof action==='string') ? $.trim(action):'';
url=url||window.location.href||'';
if(url){
url=(url.match(/^([^#]+)/)||[])[1];
}
options=$.extend(true, {
url: url,
success: $.ajaxSettings.success,
type: method||'GET',
iframeSrc: /^https/i.test(window.location.href||'') ? 'javascript:false':'about:blank'
}, options);
var veto={};
this.trigger('form-pre-serialize', [this, options, veto]);
if(veto.veto){
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
if(options.beforeSerialize&&options.beforeSerialize(this, options)===false){
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var traditional=options.traditional;
if(traditional===undefined){
traditional=$.ajaxSettings.traditional;
}
var elements=[];
var qx, a=this.formToArray(options.semantic, elements);
if(options.data){
options.extraData=options.data;
qx=$.param(options.data, traditional);
}
if(options.beforeSubmit&&options.beforeSubmit(a, this, options)===false){
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
this.trigger('form-submit-validate', [a, this, options, veto]);
if(veto.veto){
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q=$.param(a, traditional);
if(qx){
q=(q ? (q + '&' + qx):qx);
}
if(options.type.toUpperCase()=='GET'){
options.url +=(options.url.indexOf('?') >=0 ? '&':'?') + q;
options.data=null;
}else{
options.data=q;
}
var callbacks=[];
if(options.resetForm){
callbacks.push(function(){ $form.resetForm(); });
}
if(options.clearForm){
callbacks.push(function(){ $form.clearForm(options.includeHidden); });
}
if(!options.dataType&&options.target){
var oldSuccess=options.success||function(){};
callbacks.push(function(data){
var fn=options.replaceTarget ? 'replaceWith':'html';
$(options.target)[fn](data).each(oldSuccess, arguments);
});
}
else if(options.success){
callbacks.push(options.success);
}
options.success=function(data, status, xhr){
var context=options.context||options;
for (var i=0, max=callbacks.length; i < max; i++){
callbacks[i].apply(context, [data, status, xhr||$form, $form]);
}};
var fileInputs=$('input:file:enabled[value]', this);
var hasFileInputs=fileInputs.length > 0;
var mp='multipart/form-data';
var multipart=($form.attr('enctype')==mp||$form.attr('encoding')==mp);
var fileAPI=feature.fileapi&&feature.formdata;
log("fileAPI :" + fileAPI);
var shouldUseFrame=(hasFileInputs||multipart)&&!fileAPI;
if(options.iframe!==false&&(options.iframe||shouldUseFrame)){
if(options.closeKeepAlive){
$.get(options.closeKeepAlive, function(){
fileUploadIframe(a);
});
}else{
fileUploadIframe(a);
}}
else if((hasFileInputs||multipart)&&fileAPI){
fileUploadXhr(a);
}else{
$.ajax(options);
}
for (var k=0; k < elements.length; k++)
elements[k]=null;
this.trigger('form-submit-notify', [this, options]);
return this;
function fileUploadXhr(a){
var formdata=new FormData();
for (var i=0; i < a.length; i++){
formdata.append(a[i].name, a[i].value);
}
if(options.extraData){
for (var p in options.extraData)
if(options.extraData.hasOwnProperty(p))
formdata.append(p, options.extraData[p]);
}
options.data=null;
var s=$.extend(true, {}, $.ajaxSettings, options, {
contentType: false,
processData: false,
cache: false,
type: 'POST'
});
if(options.uploadProgress){
s.xhr=function(){
var xhr=jQuery.ajaxSettings.xhr();
if(xhr.upload){
xhr.upload.onprogress=function(event){
var percent=0;
var position=event.loaded||event.position;
var total=event.total;
if(event.lengthComputable){
percent=Math.ceil(position / total * 100);
}
options.uploadProgress(event, position, total, percent);
};}
return xhr;
};}
s.data=null;
var beforeSend=s.beforeSend;
s.beforeSend=function(xhr, o){
o.data=formdata;
if(beforeSend)
beforeSend.call(o, xhr, options);
};
$.ajax(s);
}
function fileUploadIframe(a){
var form=$form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
var useProp = !!$.fn.prop;
if($(':input[name=submit],:input[id=submit]', form).length){
alert('Error: Form elements must not have name or id of "submit".');
return;
}
if(a){
for (i=0; i < elements.length; i++){
el=$(elements[i]);
if(useProp)
el.prop('disabled', false);
else
el.removeAttr('disabled');
}}
s=$.extend(true, {}, $.ajaxSettings, options);
s.context=s.context||s;
id='jqFormIO' + (new Date().getTime());
if(s.iframeTarget){
$io=$(s.iframeTarget);
n=$io.attr('name');
if(!n)
$io.attr('name', id);
else
id=n;
}else{
$io=$('');
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
}
io=$io[0];
xhr={
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function(){},
getResponseHeader: function(){},
setRequestHeader: function(){},
abort: function(status){
var e=(status==='timeout' ? 'timeout':'aborted');
log('aborting upload... ' + e);
this.aborted=1;
$io.attr('src', s.iframeSrc);
xhr.error=e;
if(s.error)
s.error.call(s.context, xhr, e, status);
if(g)
$.event.trigger("ajaxError", [xhr, s, e]);
if(s.complete)
s.complete.call(s.context, xhr, e);
}};
g=s.global;
if(g&&0===$.active++){
$.event.trigger("ajaxStart");
}
if(g){
$.event.trigger("ajaxSend", [xhr, s]);
}
if(s.beforeSend&&s.beforeSend.call(s.context, xhr, s)===false){
if(s.global){
$.active--;
}
return;
}
if(xhr.aborted){
return;
}
sub=form.clk;
if(sub){
n=sub.name;
if(n&&!sub.disabled){
s.extraData=s.extraData||{};
s.extraData[n]=sub.value;
if(sub.type=="image"){
s.extraData[n+'.x']=form.clk_x;
s.extraData[n+'.y']=form.clk_y;
}}
}
var CLIENT_TIMEOUT_ABORT=1;
var SERVER_ABORT=2;
function getDoc(frame){
var doc=frame.contentWindow ? frame.contentWindow.document:frame.contentDocument ? frame.contentDocument:frame.document;
return doc;
}
var csrf_token=$('meta[name=csrf-token]').attr('content');
var csrf_param=$('meta[name=csrf-param]').attr('content');
if(csrf_param&&csrf_token){
s.extraData=s.extraData||{};
s.extraData[csrf_param]=csrf_token;
}
function doSubmit(){
var t=$form.attr('target'), a=$form.attr('action');
form.setAttribute('target',id);
if(!method){
form.setAttribute('method', 'POST');
}
if(a!=s.url){
form.setAttribute('action', s.url);
}
if(! s.skipEncodingOverride&&(!method||/post/i.test(method))){
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
if(s.timeout){
timeoutHandle=setTimeout(function(){ timedOut=true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
}
function checkState(){
try {
var state=getDoc(io).readyState;
log('state=' + state);
if(state&&state.toLowerCase()=='uninitialized')
setTimeout(checkState,50);
}
catch(e){
log('Server abort: ' , e, ' (', e.name, ')');
cb(SERVER_ABORT);
if(timeoutHandle)
clearTimeout(timeoutHandle);
timeoutHandle=undefined;
}}
var extraInputs=[];
try {
if(s.extraData){
for (var n in s.extraData){
if(s.extraData.hasOwnProperty(n)){
extraInputs.push($('').attr('value',s.extraData[n])
.appendTo(form)[0]);
}}
}
if(!s.iframeTarget){
$io.appendTo('body');
if(io.attachEvent)
io.attachEvent('onload', cb);
else
io.addEventListener('load', cb, false);
}
setTimeout(checkState,15);
form.submit();
}
finally {
form.setAttribute('action',a);
if(t){
form.setAttribute('target', t);
}else{
$form.removeAttr('target');
}
$(extraInputs).remove();
}}
if(s.forceSync){
doSubmit();
}else{
setTimeout(doSubmit, 10);
}
var data, doc, domCheckCount=50, callbackProcessed;
function cb(e){
if(xhr.aborted||callbackProcessed){
return;
}
try {
doc=getDoc(io);
}
catch(ex){
log('cannot access response document: ', ex);
e=SERVER_ABORT;
}
if(e===CLIENT_TIMEOUT_ABORT&&xhr){
xhr.abort('timeout');
return;
}
else if(e==SERVER_ABORT&&xhr){
xhr.abort('server abort');
return;
}
if(!doc||doc.location.href==s.iframeSrc){
if(!timedOut)
return;
}
if(io.detachEvent)
io.detachEvent('onload', cb);
else
io.removeEventListener('load', cb, false);
var status='success', errMsg;
try {
if(timedOut){
throw 'timeout';
}
var isXml=s.dataType=='xml'||doc.XMLDocument||$.isXMLDoc(doc);
log('isXml='+isXml);
if(!isXml&&window.opera&&(doc.body===null||!doc.body.innerHTML)){
if(--domCheckCount){
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}}
var docRoot=doc.body ? doc.body:doc.documentElement;
xhr.responseText=docRoot ? docRoot.innerHTML:null;
xhr.responseXML=doc.XMLDocument ? doc.XMLDocument:doc;
if(isXml)
s.dataType='xml';
xhr.getResponseHeader=function(header){
var headers={'content-type': s.dataType};
return headers[header];
};
if(docRoot){
xhr.status=Number(docRoot.getAttribute('status'))||xhr.status;
xhr.statusText=docRoot.getAttribute('statusText')||xhr.statusText;
}
var dt=(s.dataType||'').toLowerCase();
var scr=/(json|script|text)/.test(dt);
if(scr||s.textarea){
var ta=doc.getElementsByTagName('textarea')[0];
if(ta){
xhr.responseText=ta.value;
xhr.status=Number(ta.getAttribute('status'))||xhr.status;
xhr.statusText=ta.getAttribute('statusText')||xhr.statusText;
}
else if(scr){
var pre=doc.getElementsByTagName('pre')[0];
var b=doc.getElementsByTagName('body')[0];
if(pre){
xhr.responseText=pre.textContent ? pre.textContent:pre.innerText;
}
else if(b){
xhr.responseText=b.textContent ? b.textContent:b.innerText;
}}
}
else if(dt=='xml'&&!xhr.responseXML&&xhr.responseText){
xhr.responseXML=toXml(xhr.responseText);
}
try {
data=httpData(xhr, dt, s);
}
catch (e){
status='parsererror';
xhr.error=errMsg=(e||status);
}}
catch (e){
log('error caught: ',e);
status='error';
xhr.error=errMsg=(e||status);
}
if(xhr.aborted){
log('upload aborted');
status=null;
}
if(xhr.status){
status=(xhr.status >=200&&xhr.status < 300||xhr.status===304) ? 'success':'error';
}
if(status==='success'){
if(s.success)
s.success.call(s.context, data, 'success', xhr);
if(g)
$.event.trigger("ajaxSuccess", [xhr, s]);
}
else if(status){
if(errMsg===undefined)
errMsg=xhr.statusText;
if(s.error)
s.error.call(s.context, xhr, status, errMsg);
if(g)
$.event.trigger("ajaxError", [xhr, s, errMsg]);
}
if(g)
$.event.trigger("ajaxComplete", [xhr, s]);
if(g&&! --$.active){
$.event.trigger("ajaxStop");
}
if(s.complete)
s.complete.call(s.context, xhr, status);
callbackProcessed=true;
if(s.timeout)
clearTimeout(timeoutHandle);
setTimeout(function(){
if(!s.iframeTarget)
$io.remove();
xhr.responseXML=null;
}, 100);
}
var toXml=$.parseXML||function(s, doc){
if(window.ActiveXObject){
doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(s);
}else{
doc=(new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc&&doc.documentElement&&doc.documentElement.nodeName!='parsererror') ? doc:null;
};
var parseJSON=$.parseJSON||function(s){
return window['eval']('(' + s + ')');
};
var httpData=function(xhr, type, s){
var ct=xhr.getResponseHeader('content-type')||'',
xml=type==='xml'||!type&&ct.indexOf('xml') >=0,
data=xml ? xhr.responseXML:xhr.responseText;
if(xml&&data.documentElement.nodeName==='parsererror'){
if($.error)
$.error('parsererror');
}
if(s&&s.dataFilter){
data=s.dataFilter(data, type);
}
if(typeof data==='string'){
if(type==='json'||!type&&ct.indexOf('json') >=0){
data=parseJSON(data);
}else if(type==="script"||!type&&ct.indexOf("javascript") >=0){
$.globalEval(data);
}}
return data;
};}};
$.fn.ajaxForm=function(options){
options=options||{};
options.delegation=options.delegation&&$.isFunction($.fn.on);
if(!options.delegation&&this.length===0){
var o={ s: this.selector, c: this.context };
if(!$.isReady&&o.s){
log('DOM not ready, queuing ajaxForm');
$(function(){
$(o.s,o.c).ajaxForm(options);
});
return this;
}
log('terminating; zero elements found by selector' + ($.isReady ? '':' (DOM not ready)'));
return this;
}
if(options.delegation){
$(document)
.off('submit.form-plugin', this.selector, doAjaxSubmit)
.off('click.form-plugin', this.selector, captureSubmittingElement)
.on('submit.form-plugin', this.selector, options, doAjaxSubmit)
.on('click.form-plugin', this.selector, options, captureSubmittingElement);
return this;
}
return this.ajaxFormUnbind()
.bind('submit.form-plugin', options, doAjaxSubmit)
.bind('click.form-plugin', options, captureSubmittingElement);
};
function doAjaxSubmit(e){
var options=e.data;
if(!e.isDefaultPrevented()){
e.preventDefault();
$(this).ajaxSubmit(options);
}}
function captureSubmittingElement(e){
var target=e.target;
var $el=$(target);
if(!($el.is(":submit,input:image"))){
var t=$el.closest(':submit');
if(t.length===0){
return;
}
target=t[0];
}
var form=this;
form.clk=target;
if(target.type=='image'){
if(e.offsetX!==undefined){
form.clk_x=e.offsetX;
form.clk_y=e.offsetY;
}else if(typeof $.fn.offset=='function'){
var offset=$el.offset();
form.clk_x=e.pageX - offset.left;
form.clk_y=e.pageY - offset.top;
}else{
form.clk_x=e.pageX - target.offsetLeft;
form.clk_y=e.pageY - target.offsetTop;
}}
setTimeout(function(){ form.clk=form.clk_x=form.clk_y=null; }, 100);
}
$.fn.ajaxFormUnbind=function(){
return this.unbind('submit.form-plugin click.form-plugin');
};
$.fn.formToArray=function(semantic, elements){
var a=[];
if(this.length===0){
return a;
}
var form=this[0];
var els=semantic ? form.getElementsByTagName('*'):form.elements;
if(!els){
return a;
}
var i,j,n,v,el,max,jmax;
for(i=0, max=els.length; i < max; i++){
el=els[i];
n=el.name;
if(!n){
continue;
}
if(semantic&&form.clk&&el.type=="image"){
if(!el.disabled&&form.clk==el){
a.push({name: n, value: $(el).val(), type: el.type });
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
v=$.fieldValue(el, true);
if(v&&v.constructor==Array){
if(elements)
elements.push(el);
for(j=0, jmax=v.length; j < jmax; j++){
a.push({name: n, value: v[j]});
}}
else if(feature.fileapi&&el.type=='file'&&!el.disabled){
if(elements)
elements.push(el);
var files=el.files;
if(files.length){
for (j=0; j < files.length; j++){
a.push({name: n, value: files[j], type: el.type});
}}else{
a.push({ name: n, value: '', type: el.type });
}}
else if(v!==null&&typeof v!='undefined'){
if(elements)
elements.push(el);
a.push({name: n, value: v, type: el.type, required: el.required});
}}
if(!semantic&&form.clk){
var $input=$(form.clk), input=$input[0];
n=input.name;
if(n&&!input.disabled&&input.type=='image'){
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}}
return a;
};
$.fn.formSerialize=function(semantic){
return $.param(this.formToArray(semantic));
};
$.fn.fieldSerialize=function(successful){
var a=[];
this.each(function(){
var n=this.name;
if(!n){
return;
}
var v=$.fieldValue(this, successful);
if(v&&v.constructor==Array){
for (var i=0,max=v.length; i < max; i++){
a.push({name: n, value: v[i]});
}}
else if(v!==null&&typeof v!='undefined'){
a.push({name: this.name, value: v});
}});
return $.param(a);
};
$.fn.fieldValue=function(successful){
for (var val=[], i=0, max=this.length; i < max; i++){
var el=this[i];
var v=$.fieldValue(el, successful);
if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length)){
continue;
}
if(v.constructor==Array)
$.merge(val, v);
else
val.push(v);
}
return val;
};
$.fieldValue=function(el, successful){
var n=el.name, t=el.type, tag=el.tagName.toLowerCase();
if(successful===undefined){
successful=true;
}
if(successful&&(!n||el.disabled||t=='reset'||t=='button' ||
(t=='checkbox'||t=='radio')&&!el.checked ||
(t=='submit'||t=='image')&&el.form&&el.form.clk!=el ||
tag=='select'&&el.selectedIndex==-1)){
return null;
}
if(tag=='select'){
var index=el.selectedIndex;
if(index < 0){
return null;
}
var a=[], ops=el.options;
var one=(t=='select-one');
var max=(one ? index+1:ops.length);
for(var i=(one ? index:0); i < max; i++){
var op=ops[i];
if(op.selected){
var v=op.value;
if(!v){
v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified)) ? op.text:op.value;
}
if(one){
return v;
}
a.push(v);
}}
return a;
}
return $(el).val();
};
$.fn.clearForm=function(includeHidden){
return this.each(function(){
$('input,select,textarea', this).clearFields(includeHidden);
});
};
$.fn.clearFields=$.fn.clearInputs=function(includeHidden){
var re=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
return this.each(function(){
var t=this.type, tag=this.tagName.toLowerCase();
if(re.test(t)||tag=='textarea'){
this.value='';
}
else if(t=='checkbox'||t=='radio'){
this.checked=false;
}
else if(tag=='select'){
this.selectedIndex=-1;
}
else if(includeHidden){
if((includeHidden===true&&/hidden/.test(t)) ||
(typeof includeHidden=='string'&&$(this).is(includeHidden)))
this.value='';
}});
};
$.fn.resetForm=function(){
return this.each(function(){
if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType)){
this.reset();
}});
};
$.fn.enable=function(b){
if(b===undefined){
b=true;
}
return this.each(function(){
this.disabled = !b;
});
};
$.fn.selected=function(select){
if(select===undefined){
select=true;
}
return this.each(function(){
var t=this.type;
if(t=='checkbox'||t=='radio'){
this.checked=select;
}
else if(this.tagName.toLowerCase()=='option'){
var $sel=$(this).parent('select');
if(select&&$sel[0]&&$sel[0].type=='select-one'){
$sel.find('option').selected(false);
}
this.selected=select;
}});
};
$.fn.ajaxSubmit.debug=false;
function log(){
if(!$.fn.ajaxSubmit.debug)
return;
var msg='[jquery.form] ' + Array.prototype.join.call(arguments,'');
if(window.console&&window.console.log){
window.console.log(msg);
}
else if(window.opera&&window.opera.postError){
window.opera.postError(msg);
}}
})(jQuery);